<!DOCTYPE html>
<html>

<head>
    <style>
        body {
            margin: 0;
            padding: 0;
            background-color: #E9E9E9;
        }
        .test{
            /* margin-left: 40px; */
            overflow: hidden;
        }
        div.polaroid {
            box-sizing: border-box;
            width: 294px;
            padding: 10px 10px 20px 10px;
            border: 1px solid #BFBFBF;
            background-color: white;
            /* Add box-shadow */
            box-shadow: 1px 1px 20px #000;
        }
        img{
            width: 100%;
        }
        div.rotate_left {
            /* float: left; */
            transform: rotate(20deg);
            /* transform: translate(50px,50px); */
        }

        div.rotate_right {
            float: left;
            transform: rotate(-8deg);
        }

        .testdiv {
            /* position: relative; */
            /* top: -20px; */
            margin-top: -50px;
            width: 200px;
            height: 200px;
            border: 1px solid red;
        }
    </style>
</head>

<body>

    <div class="test">
        <div class="polaroid rotate_left">
            <img src="https://www.w3school.com.cn/i/ballade_dream.jpg" alt="郁金香" width="284" height="213" />
            <p class="caption">上海鲜花港的郁金香，花名：Ballade Dream。</p>
        </div>
        <div class="testdiv"></div>
        <!-- <div class="polaroid rotate_right">
            <img src="https://www.w3school.com.cn/i/china_pavilion.jpg" alt="世博中国馆" width="284" height="213" />
            <p class="caption">2010年上海世博会，中国馆。</p>
        </div> -->
    </div>
    <h1>canvas绘制</h1>

    <canvas id="canvas"></canvas>

</body>
<script src="../dist/main.js"></script>

<script>
    const root = document.querySelector(".test")

    layout(root, 'canvas')
    let timer;
    window.addEventListener('resize', () => {
        if (timer) { clearTimeout(timer) }
        timer = setTimeout(function () {
            layout(root, 'canvas')

        }, 100);
    })
</script>

</html>